import 'package:flutter/material.dart';

class DigetDemo {
  static showModalBottom(BuildContext context, Widget child) {
    showModalBottomSheet(
      context: context,
      backgroundColor: Color(0),
      barrierColor: Colors.green.withOpacity(0.1),
      builder: (context) => child,
    );
  }

  static showAlertDialog(BuildContext context) {
    showDialog(
        // 设置点击 dialog 外部不取消 dialog，默认能够取消
        barrierDismissible: false,
        context: context,
        builder: (context) => AlertDialog(
              title: Text('我是个标题...嗯，标题..'),
              titleTextStyle: TextStyle(color: Colors.purple), // 标题文字样式
              content: Text(r'我是内容\(^o^)/~, 我是内容\(^o^)/~, 我是内容\(^o^)/~'),
              contentTextStyle: TextStyle(color: Colors.green), // 内容文字样式
              elevation: 8.0, // 投影的阴影高度
              shape: Border.all(),
              actions: <Widget>[
                FlatButton(
                    onPressed: () => Navigator.pop(context),
                    child: Text('你点我试试.')),
              ],
            ));
  }

  static showSimpleDialog(BuildContext context, Widget child) {
    showDialog(
        barrierDismissible: false,
        context: context,
        //  barrierColor: Colors.green.withOpacity(0.2),
        builder: (context) => AlertDialog(
              contentPadding: const EdgeInsets.fromLTRB(0.0, 0, 0.0, 0),
              content: InkWell(
                onTap: () => Navigator.pop(context),
                child: child,
              ),
            ));
  }
}
